package com.ynding.cloud.common.model.bo;

/**
 * 返回码
 *
 * @author ynding
 * @version 2020/08/27
 */
public enum ResponseCode implements IResponseCode {
    /**
     * success
     */
    SUCCESS_CODE(200, ""),
    BAD_REQUEST(400, "Bad Request"),
    ACCESS_UNAUTHORIZED(401, "访问未授权"),
    TOKEN_TIMEOUT_CODE(402, "token无效或已过期"),
    TOKEN_ACCESS_FORBIDDEN(403, "token已被禁止访问"),
    NOT_FOUND(404, "not_found"),
    SERVER_ERROR_CODE(500, "server_error"),
    USER_AlREAD_EXIST_EXCEPTION(501, "用户已经存在"),
    PARAM_ERROR_CODE(600, "param_error"),
    LIMIT_ERROR_CODE(601, "limit_error"),
    DOWNGRADE(602, "downgrade"),
    BOOK_FEIGN_ERROR(700, "调用book服务失败"),

    ;

    private final int code;
    private final String message;

    private ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }
}
